//package com.zmn.plat.dubbo.impl.company;
//
//import javax.annotation.Resource;
//
//import com.zmn.common.utils.number.NumberUtil;
//import com.zmn.common.utils.string.StringUtil;
//import com.zmn.plat.common.dto.company.CompanyModifyDIO;
//import org.apache.dubbo.config.annotation.Service;
//import org.jetbrains.annotations.NotNull;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.cache.annotation.CacheConfig;
//
//import com.zmn.common.constant.GlobalConsts;
//import com.zmn.plat.business.interfaces.company.BaseCompanyBService;
//import com.zmn.plat.common.dto.company.CompanyDRO;
//import com.zmn.plat.dubbo.interfaces.company.BaseCompanyModifyRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import com.zmn.plat.model.entity.company.BaseCompany;
//import com.zmn.plat.services.interfaces.company.BaseCompanyService;
//import com.zmn.plat.utils.bean.BeanCopyUtils;
//
///**
// * @author duanzuocai
// * @version v1.0
// * @since 2018/10/18 9:22
// */
//@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
//@CacheConfig(cacheNames = "redis1h")
//@SuppressWarnings("all")
//public class BaseCompanyModifyRemoteServiceImpl implements BaseCompanyModifyRemoteService {
//    private Logger logger = LoggerFactory.getLogger(BaseCompanyModifyRemoteServiceImpl.class);
//
//    @Resource
//    BaseCompanyService baseCompanyService;
//    @Resource
//    private BaseCompanyBService baseCompanyBService;
//
//    @Override
//    public Integer addCompany(CompanyDRO dro) {
//        BaseCompany company = new BaseCompany();
//        BeanCopyUtils.copyProperties(dro, company);
//        company.setStatus(dro.getStatus() == null ? GlobalConsts.NO : dro.getStatus());
//
//        baseCompanyService.insert(company);
//
//        dro.setCompanyId(company.getCompanyId());
//
//        return company.getCompanyId();
//    }
//
//    @Override
//    public Integer addCompanyAndOrgan(CompanyDRO dro) {
//        BaseCompany company = new BaseCompany();
//        BeanCopyUtils.copyProperties(dro, company);
//        company.setStatus(dro.getStatus() == null ? GlobalConsts.NO : dro.getStatus());
//
//        baseCompanyBService.insertCompanyAndOrgan(company);
//
//        return company.getCompanyId();
//    }
//
//    @Override
//    public boolean modifyCompany(CompanyDRO dro) {
//        if (dro.getCompanyId() == null) {
//            return Boolean.FALSE;
//        }
//        BaseCompany company = getBaseCompany(dro);
//
//        company.setCompanyId(dro.getCompanyId());
//
//        int num = baseCompanyService.updateByKey(company);
//
//        return num == 0 ? Boolean.FALSE : Boolean.TRUE;
//    }
//
//    @Override
//    public Integer addCompanyByDIO(CompanyModifyDIO dio) {
//
//        // 根据公司全称校验是否已存在
//        if (StringUtil.isBlank(dio.getFullName())) {
//            return GlobalConsts.NONE;
//        }
//        BaseCompany byFullName = baseCompanyService.findByFullName(dio.getFullName());
//        if (byFullName != null && NumberUtil.isNotNullOrZero(byFullName.getCompanyId())) {
//            return byFullName.getCompanyId();
//        }
//        BaseCompany company = new BaseCompany();
//        BeanCopyUtils.copyProperties(dio, company);
//        company.setStatus(dio.getStatus() == null ? GlobalConsts.NO : dio.getStatus());
//
//        baseCompanyService.insert(company);
//
//        dio.setCompanyId(company.getCompanyId());
//
//        return company.getCompanyId();
//    }
//
//    @Override
//    public Integer addCompanyAndOrganByDIO(CompanyModifyDIO dio) {
//        BaseCompany company = new BaseCompany();
//        BeanCopyUtils.copyProperties(dio, company);
//        company.setStatus(dio.getStatus() == null ? GlobalConsts.NO : dio.getStatus());
//
//        baseCompanyBService.insertCompanyAndOrgan(company);
//
//        return company.getCompanyId();
//    }
//
//    @Override
//    public boolean modifyCompanyByDIO(CompanyModifyDIO dio) {
//        if (dio.getCompanyId() == null) {
//            return Boolean.FALSE;
//        }
//        BaseCompany company = new BaseCompany();
//        BeanCopyUtils.copyProperties(dio, company);
//        company.setCompanyId(dio.getCompanyId());
//        int num = baseCompanyService.updateByKeySelective(company);
//
//        return num == 0 ? Boolean.FALSE : Boolean.TRUE;
//    }
//
//
//    @NotNull
//    private BaseCompany getBaseCompany(CompanyDRO dro) {
//        BaseCompany company = new BaseCompany();
//        company.setName(dro.getName());
//        company.setFullName(dro.getFullName());
//        company.setType(dro.getType());
//        company.setChildType(dro.getChildType());
//        company.setFirstLetter(dro.getFirstLetter());
//        company.setProvinceId(dro.getProvinceId());
//        company.setCityId(dro.getCityId());
//        company.setCountyId(dro.getCountyId());
//        company.setAddress(dro.getAddress());
//        company.setBrief(dro.getBrief());
//        company.setBusinessLicense(dro.getBusinessLicense());
//        company.setContact(dro.getContact());
//        company.setMobile(dro.getMobile());
//        company.setFinancePhone(dro.getFinancePhone());
//        company.setServicePhone(dro.getServicePhone());
//        company.setTechPhone(dro.getTechPhone());
//        company.setLegalPersonName(dro.getLegalPersonName());
//        company.setStatus(dro.getStatus() == null ? GlobalConsts.NO : dro.getStatus());
//        company.setStreet(dro.getStreet());
//        company.setLegalPersonIdcard(dro.getLegalPersonIdcard());
//        company.setLegalPersonIdcardFrontimg(dro.getLegalPersonIdcardFrontimg());
//        company.setLegalPersonIdcardBackimg(dro.getLegalPersonIdcardBackimg());
//        company.setRegistTime(dro.getRegistTime());
//        company.setBusinessLicenseImg1(dro.getBusinessLicenseImg1());
//        company.setBusinessLicenseImg2(dro.getBusinessLicenseImg2());
//        company.setTaxpayerIdentityNum(dro.getTaxpayerIdentityNum());
//        company.setBankName(dro.getBankName());
//        company.setBankCardName(dro.getBankCardName());
//        company.setBankCardNo(dro.getBankCardNo());
//        return company;
//    }
//
//}
